/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package metro;

import cards.Card;
import java.util.Calendar;
import java.util.Date;

/**
 *
 * @author Oksana_Moroz
 */
public class Tourniquet {

    protected long id;
    protected MetroSystem system;

    public Tourniquet(long id, MetroSystem system) {
        this.id = id;
        this.system = system;
    }

    public long getID() {
        return id;
    }

    public boolean checkPass(Card card) {
        Calendar calendar = Calendar.getInstance();
        Date current = calendar.getTime();
        if (card.makeTrip()) {
            system.addPermission(card, current, this);
            return true;
        } else {
            system.addProhibition(card, current, this);
            return false;
        }
    }
}
